import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document, Types } from 'mongoose';

export type ExamQuestionDocument = ExamQuestion & Document;

@Schema({ timestamps: true })
export class ExamQuestion extends Document {

  @Prop({ type: Types.ObjectId, ref: 'Material', required: true })
  materialId: Types.ObjectId;

  @Prop([{ 
    type: Types.ObjectId, 
    ref: 'Question',
    required: true 
  }])
  questionIds: Types.ObjectId[];
}

export const ExamQuestionSchema = SchemaFactory.createForClass(ExamQuestion);